package com.edfu.core.testmgt.persistence.entity;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.edfu.core.identitymgt.persistence.entity.UserEntity;

@Entity
@Table(name = "user_test_answers")
public class UserTestAnswersEntity implements ITestMgtEntity {
	
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private long id;
	
	@ManyToOne
	@JoinColumn(name = "user_id", nullable = false)
	private UserEntity user;
	
	@ManyToOne
	@JoinColumn(name = "test_id", nullable = false)
	private TestEntity test;
	
	@ManyToOne
	@JoinColumn(name = "question_id", nullable = false)
	private QuestionEntity question;
	
	@ManyToOne
	@JoinColumn(name = "option_id", nullable = false)
	private OptionEntity option;
	
	private long testDate;

	public long getId() {
		return id;
	}
	public void setId(long id) {
		this.id = id;
	}

	public UserEntity getUser() {
		return user;
	}
	public void setUser(UserEntity user) {
		this.user = user;
	}

	public TestEntity getTest() {
		return test;
	}
	public void setTest(TestEntity test) {
		this.test = test;
	}

	public QuestionEntity getQuestion() {
		return question;
	}
	public void setQuestion(QuestionEntity question) {
		this.question = question;
	}

	public OptionEntity getOption() {
		return option;
	}
	public void setOption(OptionEntity option) {
		this.option = option;
	}	
	
	public long getTestDate() {
		return testDate;
	}
	public void setTestDate(long testDate) {
		this.testDate = testDate;
	}
	
	@Override
	public String toString() {
		return "UserTestAnswersEntity [user=" + user + ", test=" + test
				+ ", question=" + question + ", option=" + option + "]";
	}
	
}
